//
//  GTResouceDetailStatusTableViewCell.m
//  ShangHaiHuDongApp
//
//  Created by 刘应平 on 2017/8/14.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "GTResouceDetailStatusTableViewCell.h"

@interface GTResouceDetailStatusTableViewCell ()
/**  titile  */
@property (strong, nonatomic) UILabel  *titleLabel;
/**  内容  */
@property (strong, nonatomic) UILabel  *content;
@end
@implementation GTResouceDetailStatusTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

/**  50  */
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.titleLabel = [UILabel new];
        self.titleLabel.textAlignment = NSTextAlignmentLeft;
        self.titleLabel.textColor = [UIColor textBlackColor];
        self.titleLabel.font = LYPFONT(16);
        [self addSubview:self.titleLabel];
        self.titleLabel.sd_layout
        .topSpaceToView(self, 15 * [UIScreen zj_screenHScale])
        .leftSpaceToView(self, 20 * [UIScreen zj_screenWScale])
        .heightIs(20 * [UIScreen zj_screenHScale])
        .widthIs([UIScreen zj_screenWith] - 100 * [UIScreen zj_screenWScale]);
        
        self.content = [UILabel new];
        self.content.textAlignment = NSTextAlignmentCenter;
        self.content.textColor = [UIColor whiteColor];
        self.content.backgroundColor = [UIColor themeColor];
        self.content.layer.cornerRadius = 10;
        self.content.layer.masksToBounds = YES;
        self.content.font = LYPFONT(15);
        [self addSubview:self.content];
        self.content.sd_layout
        .topSpaceToView(self, 12.5 * [UIScreen zj_screenHScale])
        .leftSpaceToView(self.titleLabel, 20 * [UIScreen zj_screenWScale])
        .heightIs(25 * [UIScreen zj_screenHScale])
        .widthIs(100 * [UIScreen zj_screenWScale]);
        
        UIView *under = [UIView new];
        under.backgroundColor = [UIColor themeGrayColor];
        [self addSubview:under];
        under.sd_layout.leftEqualToView(self).bottomEqualToView(self).widthIs([UIScreen zj_screenWith]).heightIs(1);
    }
    return self;
}

- (void)setModel:(ShareResouceDetailModel *)model{
    _model = model;
    
    self.titleLabel.text = model.title;
    self.titleLabel.sd_layout.widthIs(model.titleWidth);
    [self.titleLabel updateLayout];
    
    self.content.text = model.content;
}

@end
